include Makefile.d

all: prepare bin static dynamic

clean:
	@rm -rf $(OUTDIR) -v
	
prepare:
	@if [ ! -d $(OUTDIR) ]; then \
		mkdir -p $(OUTDIR)/include; \
		cp include/* $(OUTDIR)/include/ -rf; \
		mkdir -p $(OUTDIR)/bin; \
	    mkdir -p $(OUTDIR)/lib; \
	    mkdir -p $(OUTDIR)/so; \
	fi

static:
	$(CC) -c ./src/*.cpp $(CPPFLAGS) $(INCLUDES) $(LDFLAGS)
	@mv *.o ./output/lib
	ar -rs ./output/lib/lib$(TARGETS).a ./output/lib/*.o
	rm ./output/lib/*.o	
	
dynamic:
	$(CC) -shared -fPIC ./src/*.cpp $(CPPFLAGS) $(INCLUDES) $(LDFLAGS) -o $(OUTDIR)/so/$(TARGETS).so
	
bin:
	$(CC) -fPIC -DBIN ./src/*.cpp $(CPPFLAGS) $(INCLUDES) $(LDFLAGS) -o $(OUTDIR)/bin/$(TARGETS)
	
	
	